#
# from datetime import datetime
#
# # 流水登记的时间
# # 文件：bank_info_{user}.txt  / bank_flow.txt
# # bank_info_{user}.txt : 用户-登录密码-银行卡号-取款密码-余额（初始定为1000）
# # bank_flow.txt : 用户>>>操作>>>时间
# # 取款 :  验证你的取款密码，更改余额   余额(1000) ，记录你的提款信息 -- 文件里 - 加时间
# # 转账 ： 验证你的取款密码，更改余额 目标银行卡号去转 记录你的提款信息 -- 文件里
#
# time = f'时间为:>>>> {datetime.now().strftime("%Y年%m月%d日 %H时%M分%S秒")}'
# login_info = {}   # 记录登录信息
#
#
# def outer(func):
#     bank_basic_info = {}
#
#     def inner(tag):
#         bank_username = input("请输入用户名:")
#         bank_password = input("请输入密码:")
#         if tag == 'register':
#             bank_num, bank_withdraw_pwd = func()
#             bank_basic_info[bank_username] = {'pwd': bank_password, 'bank_num': bank_num, 'bank_pwd': bank_withdraw_pwd}
#             save_data(bank_basic_info)
#         elif tag == 'login':
#             data = {'user': {'pwd': '001'}}
#             if bank_password == data.get(bank_username)['pwd']:
#                 login_info[bank_username] = {'excists': True}
#                 # 如果是登录，将他的登录状态显示为上线
#                 str_data = f"{bank_username}:>>>>>登录成功>>>{time}"
#                 save_file('bank_flow.txt',str_data)
#                 return True,"登录成功"
#
#     return inner
# def save_file(path,str_data):
#     with open(path,'a',encoding='utf8') as fp:
#         fp.write(str_data + '\n')
#
# @outer
# def register():  # 用户-登录密码-银行卡号-取款密码
#     bank_num = input("请输入银行卡号")
#     bank_withdraw_pwd = input("请输入取款密码:")
#     return bank_num, bank_withdraw_pwd
#
#
# def save_data(data):
#     bank_basic_info = data  # {'user': {'pwd': '001', 'bank_num': '1234', 'ban_pwd': '001'}}
#     print(bank_basic_info)
#
#
# def read_data():
#     ...
#
# @outer
# def login():  # 读数据
#     data = {'user': {'pwd': '001'}}
#     return data
#
#
# print(login('login'))
#
#
# # print(register('register'))
#
#
# def withdraw_money():  # 取款
#     ...
#
#
# def transfer_money():  # 转账
#     ...
#
#
# def recharge():  # 充值
#     ...
#
#
# def check_flow():  # 查看余额
#     ...
#
#
# def bank_info():  # 卡号，余额，流水
#     ...
#
#
# def quit_system():
#     ...
#
#
# func_menu = '''
# ===================用户功能菜单=====================
#                   1.注册
#                   2.登陆
#                   3.取款
#                   4.转账
#                   5.充值余额
#                   6.查看流水
#                   7.查看银行信息(查看自己的卡号、余额、流水等信息)
#                   8.退出系统
# ======================欢迎使用=======================
# '''
# func_dict = {
#     1: register,
#     2: login,
#     3: withdraw_money,
#     4: transfer_money,
#     5: recharge,
#     6: check_flow,
#     7: bank_info,
#     8: quit_system
# }
#
#
# def main_system():
#     # 【1】打印功能菜单
#     while True:
#         print(func_menu)
#         func_id = input("请输入功能ID :>>>> ").strip()
#         if not func_id.isdigit():
#             print(f'{func_id} :>>>> 非法字符')
#             continue
#         func_id = int(func_id)
#         if func_id not in func_dict.keys():
#             print(f"{func_id} :>>>> 不存在该功能!")
#             continue
#         func = func_dict.get(func_id)
#         flag, msg = func()
#         if flag:
#             print(msg)
#         elif not flag and msg == 'break':
#             print(f"欢迎下次使用!再见!")
#             break
#         else:
#             print(msg)
#             continue
